﻿using System.Windows.Shapes;
using KBS8.Shared;

namespace KBS8.Business
{
    public class BusinessManager
    {
        private static BusinessManager _businessManager;
        private readonly RouteCalculator.RouteCalculator _routeCalculator;

        private BusinessManager()
        {
            _routeCalculator = new RouteCalculator.RouteCalculator();
        }

        /// <summary>
        /// Gives the data of the map of a specific area
        /// </summary>
        /// <param name="area">The specific area of which the system has to give the data</param>
        /// <param name="zoomlevel">The zoomlevel</param>
        public void GetRoadData(MapTile mp, int zoomlevel)
        {
            Data.DataManager.GetInstance().GetRoadData(mp, zoomlevel);
        }

        /// <summary>
        /// Generates the route
        /// </summary>
        public void GetRoute()
        {
            _routeCalculator.GetRoute(null, null);
        }

        /// <summary>
        /// The Singleton method
        /// </summary>
        /// <returns>The instance of BusinessManager</returns>
        public static BusinessManager GetInstance()
        {
            if (_businessManager == null)
                _businessManager = new BusinessManager();

            return _businessManager;
        }
    }
}
